var subjectCategoryType;
var id;
var groupid;
var iconid;
var subid;
var menuid;

$(function(){
   	 groupid = ly.getUrlParam("groupid");
	 iconid = ly.getUrlParam("iconid");
	 subid = ly.getUrlParam("subid");
	 menuid = ly.getUrlParam("menuid");	

	
	id = ly.getUrlParam("id");
		/*$("#title").html("编辑");*/
	$(".form").getForm({
	        id: id
	},function (data) {
    	if(data.wxHeadPicUrl !=null && data.wxHeadPicUrl !=''){
    		var str= "<img src='"+data.wxHeadPicUrl+"'>";
    		$("#wxHeadPicUrl").append(str);
    	}
    	if(data.isUsing==0){
    		$("#isUsing").html("禁用");
    		$("#isUsing").attr("title","1");
    	}else{
    		$("#isUsing").html("启用");
    		$("#isUsing").attr("title","0");
    	}
	});
	$("#isUsing").click(function(){
		var title = $("#isUsing").attr("title");
		var url = site.interUrl+"/sUsers/disableUser";
		var message = "";
		if(title=='0'){
			message = "启用";
		}else{
			message = "禁用";
		}
		var obj = {
			'id':id,
			'isUsing':title
		};
		request({
			url:url,
			data:obj,
			type:"post",
			ajaxform:'true',
			callback:function(f) {
				console.log(f);
				if(f.code=="rest.success"){
					ly.alert(message+"成功",function(){
						if(title=='0'){
							$("#isUsing").html("禁用");
    						$("#isUsing").attr("title","1");
    						$("#isUsingDisplay").val("启用");
						}else{
							$("#isUsing").html("启用");
    						$("#isUsing").attr("title","0");
    						$("#isUsingDisplay").val("禁用");
						}
					})
				}else{
					ly.toast(f.desc);
				}
			}
		});	
	});
});

